﻿@using ERP.WebUI
@model ChangePwdModel
@{
    ViewBag.Title = "ChangePwd";
}

<div id="content-body" class="row-fluid">
    <div class="span22">
        <div class="widget-box">
            <div class="widget-title">
                <span class="icon"><i class="icon-edit"></i></span>
                <h5>添加用户</h5>
            </div>
            <div class="widget-content nopadding">
                <form id="modal-content" class="form-horizontal search-form">

                    @Html.HiddenFor(t => t.Id)

                    <div class="control-group">
                        <label class="control-label-form">
                            @Html.DisplayNameFor(t => t.LoginName) :          
                        </label>
                        <div class="controls">
                            <label class="label-text">
                                @Model.LoginName
                            </label>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label-form">
                            @Html.DisplayNameFor(t => t.Email) :
           
                        </label>
                        <div class="controls">
                            <label class="label-text">
                                @Model.Email
                            </label>
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label-form">
                            <label class="red">*</label>@Html.DisplayNameFor(t => t.NewLoginPwd) :
                        </label>
                        <div class="controls">
                            @Html.PasswordFor(t => t.NewLoginPwd, new { @class = "form-control", value = Model.NewLoginPwd })
                            @Html.ValidationMessageFor(m => m.NewLoginPwd)
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label-form">
                            <label class="red">*</label>@Html.DisplayNameFor(t => t.NewLoginPwdConfirm) :
                        </label>
                        <div class="controls">
                            @Html.PasswordFor(t => t.NewLoginPwdConfirm, new { @class = "form-control", value = Model.NewLoginPwdConfirm })
                            @Html.ValidationMessageFor(m => m.NewLoginPwdConfirm)
                        </div>
                    </div>

                    <div class="form-actions form-operate">
                        <input type="submit" value="确定" class="btn btn-primary" id="model-submit">
                        <input type="button" value="返回" onclick="history.back(-1)" class="btn btn-primary">
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@section scripts{
    <script type="text/javascript">
        $(function () {
            $("#model-submit").click(function () {
                var $form = $("#modal-content");
                if (!$form.valid()) {
                    return;
                }
                var actionUrl = "@Url.Action("ChangePwd")";
                var data = $form.serialize();
                $.ajax({
                    type: "POST",
                    async: false,
                    url: actionUrl,
                    data: data,
                    success: function (data) {
                        //判断返回值，若为Object类型，即操作成功
                        var result = ((typeof data == 'object') && (data.constructor == Object));
                        alertMessage(1, data.Message, 5);
                        var url = "@Url.Action("Index")";
                        location.href = url;
                    }
                });
            });
        });
    </script>
}
